package active.chainofresponsibility;

public class ClientChainOfResponseBility {
    public static void main(String[] args) {
        AbstractLogger chainOfLoggers = getChainOfLoggers();

        chainOfLoggers.logMessage(AbstractLogger.INFO, "This is an infomation.");

        chainOfLoggers.logMessage(AbstractLogger.DEBUG, " This is an Debug informatin");

        chainOfLoggers.logMessage(AbstractLogger.ERROR, " This is an Error information");
    }

    private static AbstractLogger getChainOfLoggers() {
        ErrorLogger errorLogger = new ErrorLogger(AbstractLogger.ERROR);
        FileLogger fileLogger = new FileLogger(AbstractLogger.DEBUG);
        ConsoleLogger consoleLogger = new ConsoleLogger(AbstractLogger.INFO);

        errorLogger.setNextLogger(fileLogger);
        fileLogger.setNextLogger(consoleLogger);

        return errorLogger;
    }
}
